<?php
require_once(dirname(__FILE__) . '/app.php');

if ($_POST) {
	$user = Users::GetUserByEmail(strval($_POST['email']));
	if ( $user ) {
		mail_repass($user);
		Session::Set('reemail', $user['email']);
		redirect( WEB_ROOT .'/repass.php?action=ok');
	}
	Session::Set('error', '你的Email没有在本站注册');
	redirect( WEB_ROOT . '/repass.php');
}

$action = strval($_GET['action']);
if ( $action == 'ok') {
	die(include template('account_repass_ok'));
}
include template('account_repass');
